package com.mgwt.mobile.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.googlecode.mgwt.mvp.client.Animation;
import com.googlecode.mgwt.ui.client.MGWT;
import com.googlecode.mgwt.ui.client.MGWTSettings;
import com.googlecode.mgwt.ui.client.MGWTSettings.ViewPort;
import com.googlecode.mgwt.ui.client.MGWTSettings.ViewPort.DENSITY;
import com.googlecode.mgwt.ui.client.util.SuperDevModeUtil;

public class MobileApp implements EntryPoint {

	@Override
	public void onModuleLoad() {
		// will compile out when off
		SuperDevModeUtil.showDevMode();

		// set viewport and other settings for mobile
		ViewPort viewPort = new MGWTSettings.ViewPort();
		viewPort.setTargetDensity(DENSITY.MEDIUM);
		viewPort.setUserScaleAble(false).setMinimumScale(1.0).setInitialScale(1.0).setMaximumScale(1.0);
		viewPort.setHeightToDeviceHeight().setWidthToDeviceWidth();

		MGWTSettings settings = new MGWTSettings();
		settings.setViewPort(viewPort);
		settings.setIconUrl("logo.png");
		settings.setAddGlosToIcon(true);
		settings.setFullscreen(true);
		settings.setPreventScrolling(true);

		MGWT.applySettings(settings);

		//TODO add my own color theme style here

		WelcomePanel welcome = new WelcomePanel();
		new LoginPanel();
		new MainPanel();
		new RegisterPanel();
		new RegisterConfirmedPanel();

		RootPanel.get().add(Animator.getInstance());

		Animator.getInstance().goTo(welcome, Animation.DISSOLVE);
	}

}
